using System;
using System.ComponentModel;
using System.Transactions;
using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The CurrencyRateTableManager class is responsible for managing BO.CurrencyRateTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class CurrencyRateTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all CurrencyRateTable objects in the database.
/// </summary>
/// <returns>A list with all CurrencyRateTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static CurrencyRateTableList GetList(){
return CurrencyRateTableDB.GetList();
}

/// <summary>
/// Gets a single CurrencyRateTable from the database without its data.
/// </summary>
/// <param name="currencyRateKey">The CurrencyRateKey of the CurrencyRateTable in the database.</param>
/// <returns>A CurrencyRateTable object when the CurrencyRateKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static CurrencyRateTable GetItem(Int16 currencyRateKey){
return GetItem(currencyRateKey, false);
}

/// <summary>
/// Gets a single CurrencyRateTable from the database.
/// </summary>
/// <param name="currencyRateKey">The CurrencyRateKey of the CurrencyRateTable in the database.</param>
/// <param name="getCurrencyRateTableRecords">Determines whether to load all associated CurrencyRateTable records as well.</param>
/// <returns>
/// A CurrencyRateTable object when the CurrencyRateKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static CurrencyRateTable GetItem(Int16 currencyRateKey, bool getCurrencyRateTableRecords){
CurrencyRateTable myCurrencyRateTable = CurrencyRateTableDB.GetItem(currencyRateKey);
return myCurrencyRateTable;
}

/// <summary>
/// Saves a CurrencyRateTable in the database.
/// </summary>
/// <param name="myCurrencyRateTable">The CurrencyRateTable instance to save.</param>
/// <returns>The new CurrencyRateKey if the CurrencyRateTable is new in the database or the existing CurrencyRateKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static Int16 Save(CurrencyRateTable myCurrencyRateTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
Int16 currencyRateTableCurrencyRateKey = CurrencyRateTableDB.Save(myCurrencyRateTable);

//  Assign the CurrencyRateTable its new (or existing CurrencyRateKey).
myCurrencyRateTable.CurrencyRateKey = currencyRateTableCurrencyRateKey;

myTransactionScope.Complete();

return currencyRateTableCurrencyRateKey;
}
}

/// <summary>
/// Deletes a CurrencyRateTable from the database.
/// </summary>
/// <param name="myCurrencyRateTable">The CurrencyRateTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(CurrencyRateTable myCurrencyRateTable){
return CurrencyRateTableDB.Delete(myCurrencyRateTable.CurrencyRateKey);
}

#endregion

}

